package com.badger.zk.openfeign;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @EnableFeignClients 开启feign的客户端
 * @author liqi
 */
@SpringBootApplication
@EnableFeignClients
@EnableDiscoveryClient
public class ZookeeperOpenfeignApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(ZookeeperOpenfeignApplication.class, args);
    }
    
    //注入Ribbon的RestTemplate
    @LoadBalanced
    @Bean
    public RestTemplate loadBalancedRestTemplate() {
        return new RestTemplate();
    }


}
